<template>
    <view class="content">
        <scroll-view scroll-y class="list_calssify">
            <view :class="actAction == index ? 'act' : ''" v-for="(item, index) in cate " :key="index"
                @click="cheng(index)">{{
                    item.name
                }}
            </view>

        </scroll-view>
        <scroll-view scroll-y class="right_content">
            <view class="warp_warp" v-for="(item, index) in cate" :key="item._id" v-if="index == actAction">
                <view class="warp_content" v-for="(item2, index) in item.children" :key="index">
                    <image :src="item2.img" mode="scaleToFill" />
                    <view class="text">{{ item2.name }}</view>
                </view>
            </view>
        </scroll-view>
    </view>
</template>

<script>
import { get_cate } from "../../api/api"
export default {
    data() {
        return {

            cate: [],
            actAction: 0,
        }
    },
    mounted() {
        get_cate({}).then(res => {
            console.log(res.data)
            this.cate = res.data

        })
    },
    methods: {
        cheng(index) {
            console.log(index)
            this.actAction = index
        }
    },
}
</script>

<style lang="scss" scoped>
.content {
    display: flex;
    justify-content: space-between;

    .list_calssify {
        width: 200rpx;
        height: 100vh;
        background-color: #fff;
        text-align: center;

        view {
            padding: 10px 0;

        }

        .act {
            background-color: #f8f8f8;
            color: #fbd733;
        }


    }

    .right_content {
        width: 530rpx;

        .warp_warp {
            display: flex;
            flex-wrap: wrap;
            justify-content: flex-start;
            background-color: #fff;


            .warp_content {
                padding-top: 20rpx;
                // text-align: center;
                width: 33%;
                // float: left;


                image {
                    width: 100%;
                    height: 170rpx;
                }

                .text {
                    width: 100%;
                    text-align: center;
                    margin: 10rpx 0;
                    font-size: 26rpx;
                }
            }
        }

        // warp_content

    }
}
</style>